import request from '@/utils/request'



// 获得日报表数据
export function plasmaDayReport(data) {
  return request({
    url: '/plasma/view/dayReport',
    method: 'get',
    data: data,
    timeout: 100000
  })
}

// 获得采浆数据明细
export function plasmaDayDetailReport(data) {
  return request({
    url: '/plasma/view/dayReport/detail',
    method: 'get',
    data: data,
    timeout: 100000
  })
}

// 否登记
export function isRegister(donorNo) {
  return request({
    url: '/plasma/view/isRegister/' + donorNo,
    method: 'get',
    timeout:3000
  })
}

// 发放餐券
export function publicMealTicket(donorNo) {
  return request({
    url: '/plasma/view/publicMealTicket/' + donorNo,
    method: 'get',
    timeout:3000
  })
}

// 餐券数量
export function publicMealTicketCount(data) {
  return request({
    url: '/plasma/view/publicMealTicketCount',
    method: 'get',
    data: data,
    timeout: 3000
  })
}


// 获得用户任务数据
export function userPlasmaTaskIndicatorsRemark(data) {
  return request({
    url: '/plasma/view/task/indicators_remark',
    method: 'get',
    data: data,
    timeout: 100000
  })
}

// 获得用户任务数据
export function userPlasmaTaskIndicatorsXuanchuanyuan(data) {
  return request({
    url: '/plasma/view/task/indicators_xuanchuanyuan',
    method: 'get',
    data: data,
    timeout: 100000
  })
}

export function formatDate(value,args) {
  var dt = new Date(value);
  if(args == 'yyyy-M-d') {// yyyy-M-d
      let year = dt.getFullYear();
      let month = dt.getMonth() + 1;
      let date = dt.getDate();
      return `${year}-${month}-${date}`;
  } else if(args == 'yyyy-M-d H:m:s'){// yyyy-M-d H:m:s
      let year = dt.getFullYear();
      let month = dt.getMonth() + 1;
      let date = dt.getDate();
      let hour = dt.getHours();
      let minute = dt.getMinutes();
      let second = dt.getSeconds();
      return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
  } else if(args == 'yyyyMMddHHmmss'){// yyyyMMddHHmmss
    let year = dt.getFullYear();
      let month = (dt.getMonth() + 1).toString().padStart(2,'0');
      let date = dt.getDate().toString().padStart(2,'0');
      let hour = dt.getHours().toString().padStart(2,'0');
      let minute = dt.getMinutes().toString().padStart(2,'0');
      let second = dt.getSeconds().toString().padStart(2,'0');
      return `${year}${month}${date}${hour}${minute}${second}`;
} else if(args == 'yyyy-MM-dd') {// yyyy-MM-dd
      let year = dt.getFullYear();
      let month = (dt.getMonth() + 1).toString().padStart(2,'0');
      let date = dt.getDate().toString().padStart(2,'0');
      return `${year}-${month}-${date}`;
  } else if(args == 'yyyyMMdd') {// yyyy-MM-dd
      let year = dt.getFullYear();
      let month = (dt.getMonth() + 1).toString().padStart(2,'0');
      let date = dt.getDate().toString().padStart(2,'0');
      return `${year}${month}${date}`;
  } else {// yyyy-MM-dd HH:mm:ss
      let year = dt.getFullYear();
      let month = (dt.getMonth() + 1).toString().padStart(2,'0');
      let date = dt.getDate().toString().padStart(2,'0');
      let hour = dt.getHours().toString().padStart(2,'0');
      let minute = dt.getMinutes().toString().padStart(2,'0');
      let second = dt.getSeconds().toString().padStart(2,'0');
      return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
  }
}